home *** CD-ROM | disk | FTP | other *** search
- /*#include <exec/types.h>
- #include <exec/memory.h>
- #include <dos/dos.h>
- #include <stdio.h>*/
- #include "functions.h"
- #include "defines.h"
- extern UBYTE GSTR1[1024],GSTR2[1024],GSTR3[1024];
- extern long Time_system;
- extern int Whence_The_Logon;
- extern long fsize;
- extern struct Commands Cmds;
- extern struct User User;
-
- char PurgeScanNM[31];
- void PurgeScanName();
- int GetHoldDesc(char *FileName,int Conf)
- {
- struct FileInfoBlock *FBlock;
- BPTR FLock;
- FILE *fi;
- char str[200];
- char Istr[200];
- char fmtstr[200];
- char temp[80],str2[255];
- char odate[20],fcomment[70],scomment[9][50];
- int status;
- int x2,cstat;
- int dirnum;
- int Exists=0;
- strcpy(str,FileName);
-
- sm("",1);sm("Please enter a description, you have eight lines for your description.",1);
- sm("",1);sm("Press return alone to end.",1);
- sm(" [--------------------------------------------]",1);
- sprintf(fmtstr,"%-13s %7ld %s :",str,fsize,odate);
- AEPutStr(fmtstr);
- sprintf(fmtstr,"%-13sP%7ld %s ",str,fsize,odate);
- status=LineInput("",fcomment,44,KEYBOARD_TIMEOUT);
- if(status<0) { DropDTR(); return(0); }
- if(strlen(fcomment)==0) { goto CINPAgain; }
- strcat(fmtstr,fcomment); strcpy(fcomment,fmtstr);
- x2=0;
- do
- {
- AEPutStr(" :");
- status=LineInput("",scomment[x2],44,KEYBOARD_TIMEOUT);
- if(status<0) { DropDTR(); return(0); }
- x2+=1;
- } while(strlen(scomment[x2-1])!=0&&x2<7);
- if(fcomment[33]=='/')
- sprintf(Istr,"%sHOLD/%s",Cmds.ConfLoc[Conf],str);
- else
- sprintf(Istr,"%sUpload/%s",Cmds.ConfLoc[Conf],str);
-
- sprintf(fmtstr,"%sLCFILES/%s",Cmds.ConfLoc[Conf],str);
- fi=fopen(Istr,"rb");
- if(fi==NULL)
- {
- rename(fmtstr,Istr);
- sprintf(str,"touch %s",Istr); Execute(str,NULL,NULL);
- sprintf(fmtstr,"%sndirs",Cmds.ConfLoc[Conf]);
- fi=fopen(fmtstr,"r");
- if(fi==NULL) return(1);
- fgets(fmtstr,80,fi);
- dirnum=atoi(fmtstr);
- fclose(fi);
- if(fcomment[33]=='/')
- sprintf(fmtstr,"%sHold/Held",Cmds.ConfLoc[Conf]);
- else
- sprintf(fmtstr,"%sdir%d",Cmds.ConfLoc[Conf],dirnum);
- }
- else
- { Exists=1; AEPutStr("Sorry but this Upload already exists!\r\n");
- unlink(fmtstr);
- fclose(fi);
- }
-
- if(!Exists)
- {
- fi=fopen(fmtstr,"a");
- if(fi==NULL) return(1);
- dirnum=0;
- fprintf(fi,"%s\n",fcomment);
- while(dirnum<x2-1)
- {
- fprintf(fi," %s\n",scomment[dirnum]);
- dirnum++;
- }
- if(Cmds.AcLvl[20]>0)
- {
- fprintf(fi," Sent by: %s\n",User.Name);
- }
- fclose(fi);
- User.Bytes_Upload += fsize;
- User.Uploads +=1;
- if(fcomment[33]!='/')
- return(2); else return(3);
- }else return(4);
- }
-
- void ScanHoldDesc(void)
- {
- FILE *fi;
- char string[200];
- char Temp[200];
- char Text[200];
- register int i;
- int Result;
- PurgeScanName();
- sprintf(Text,"LOSS CARRIER %s",User.Name);strupr(Text);
- AEPutStr("Searching for LOSS CARRIER Files!\r\n");
- for(i=0;i<9;i++)
- {
-
- if(Cmds.ConfLoc[i]!='\0')
- {
- sprintf(string,"%sLCFILES/%s.lc",Cmds.ConfLoc[i],PurgeScanNM);
-
- fi=fopen(string,"r");
- if(fi!=NULL)
- {
- while(fgets(string,80,fi)!=NULL)
- {
- StripReturn(string);
- strcpy(Temp,string);
- strupr(&string[33]);
- if(!strcmp(Text,&string[33]))
- {
-
- string[12]='\0';
- StripReturn(string);
- Result=GetHoldDesc(string,i);
- if(Result==0) { fclose(fi); return;}
- if(Result==3)
- {
- AEPutStr("Moving ");AEPutStr(string);AEPutStr(" to Sysop Hold\r\n");
- }
- if(Result==2)
- {
- AEPutStr("Moving ");AEPutStr(string);AEPutStr(" to Download Path\r\n");
- }
- if(Result==4)
- {
- AEPutStr("Deleting ");AEPutStr(string);AEPutStr("\r\n");
- }
-
- }
- }
- sprintf(string,"%sLCFILES/%s.lc",Cmds.ConfLoc[i],PurgeScanNM);
- fclose(fi); unlink(string);
- }
-
- }
- }
- AEPutStr("\r\n");
-
- }
-
- void PurgeScanName()
- {
- char st[31];
- register int i,j;
- strcpy(st,User.Name);
- i=strlen(st);
- j=0;
- while(j<i)
- {
- if((st[j]>='A' && st[j]<='Z') || (st[j]>='a' && st[j]<='z'))
- { j++; continue;}
- if(st[j]!=0)st[j]='_';
- j++;
- }
- sprintf(PurgeScanNM,"%.27s",st);
- }